import sys
sys.path.insert(0,'../..')
from rmpoly import *
from time import time

from gmpy import mpq
try:
  import psyco
  psyco.full()
except:
  pass

rp = RPoly(['z','y','x'],6,mpq)

f = open('log','w')
p = rp('1/111 + 1/137*x + 1/1003*y + 128*z')
t0 = time()
p1 = p.miller_pow(32)
t1 = time()
f.write(str(p1))
t2 = time()
f.close
f = open('log')
s = f.read()
p2 = rp(s)
t3 = time()
assert p1 == p2
print '%s pow %.2f write %.2f read %.2f' % (sys.argv,t1-t0,t2-t1,t3-t2)
